package net.esj.basic.plugins.struts2.interceptor;

import net.esj.basic.plugins.struts2.aware.ActionContextAware;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class ActionContextInterceptor extends AbstractInterceptor {

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		if(invocation.getAction() instanceof ActionContextAware){
			ActionContextAware aware = (ActionContextAware) invocation.getAction();
			aware.setActionContext(invocation.getInvocationContext());
		}
		return invocation.invoke();
	}

}
